<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
    <th:block th:include="include :: header('用户资金流水记录列表')" />
</head>
<body class="gray-bg">
<div class="container-div">
    <div class="row">
        <div class="col-sm-12 search-collapse">
            <form id="formId">
                <div class="select-list">
                    <ul>
                        <li>
                            <label style="width: 80px">用户号：</label>
                            <input type="text" name="userCode"/>
                        </li>
                        <li>
                            <label style="width: 80px">用户账号：</label>
                            <input type="text" name="loginName"/>
                        </li>
                        <li>
                            <label style="width: 80px">相关订单号：</label>
                            <input type="text" name="ridCode"/>
                        </li>
                        <li>
                            <label style="width: 80px">变动类型：</label>
                            <select name="billcashType" th:with="type=${@dict.getType('sys_billcash_type')}">
                                <option selected=""></option>
                                <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
                            </select>
                        </li>
                        <li class="select-time">
                            <label style="width: 80px">创建时间：</label>
                            <input type="text" class="time-input" id="beginDate" placeholder="开始时间" name="params[beginTime]"/>
                            <span>-</span>
                            <input type="text" class="time-input" id="endDate" placeholder="结束时间" name="params[endTime]"/>
                        </li>
                        <li>
                            <label style="width: 80px">备注：</label>
                            <input type="text" name="billcashRemark"/>
                        </li>
                        <li>
                            <a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i class="fa fa-search"></i> 搜索</a>
                            <a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i class="fa fa-refresh"></i> 重置</a>
                        </li>
                    </ul>
                </div>
            </form>
        </div>

        <div class="btn-group-sm" id="toolbar" role="group">
            <a class="btn btn-warning" onclick="$.table.exportExcel()" shiro:hasPermission="system:billcash:export">
                <i class="fa fa-download"></i> 导出
            </a>
        </div>
        <div class="col-sm-12 select-table table-striped">
            <table id="bootstrap-table"></table>
        </div>
    </div>
</div>
<th:block th:include="include :: footer" />
<script th:inline="javascript">
    var editFlag = [[${@permission.hasPermi('system:billcash:edit')}]];
    var removeFlag = [[${@permission.hasPermi('system:billcash:remove')}]];
    var prefix = ctx + "system/billcash";

    $(function() {
        var options = {
            url: prefix + "/list",
            createUrl: prefix + "/add",
            updateUrl: prefix + "/edit/{id}",
            removeUrl: prefix + "/remove",
            exportUrl: prefix + "/export",
            modalName: "用户资金流水记录",
            columns: [{
                checkbox: true
            },
                // {
                //     field: 'billcashId',
                //     title: '商家流水记录id',
                //     visible: false
                // },
                {
                    field: 'userCode',
                    title: '用户号'
                },
                {
                    field: 'loginName',
                    title: '用户账号'
                },
                {
                    field: 'orderCode',
                    title: '相关订单号'
                },
                {
                    field: 'channelName',
                    title: '通道名称'
                },
                {
                    field: 'billcashType',
                    title: '变动类型',
                    formatter: function(value, row, index) {
                        if (value==0){
                            return '<a>支付</a>';
                        }else if(value=1){
                            return '<a>代付</a>';
                        }else if(value=2){
                            return '<a style="color: orange">手动增加</a>';
                        }else if(value=3){
                            return '<a style="color: orange">手动减少</a>';
                        }else if(value=4){
                            return '<a style="color: lawngreen">佣金</a>';
                        }else {
                            return '<a>其他</a>';
                        }
                    }
                },
                {
                    field: 'amount',
                    title: '原金额'
                },
                {
                    field: 'changeAmount',
                    title: '变动金额'
                },
                {
                    field: 'lastAmount',
                    title: '变动后金额'
                },
                {
                    field: 'createTime',
                    title: '提交时间'
                },
                {
                    field: 'billcashRemark',
                    title: '备注'
                }
                // {
                //     title: '操作',
                //     align: 'center',
                //     formatter: function(value, row, index) {
                //         var actions = [];
                //         actions.push('<a class="btn btn-success btn-xs ' + editFlag + '" href="javascript:void(0)" onclick="$.operate.edit(\'' + row.billcashId + '\')"><i class="fa fa-edit"></i>编辑</a> ');
                //         actions.push('<a class="btn btn-danger btn-xs ' + removeFlag + '" href="javascript:void(0)" onclick="$.operate.remove(\'' + row.billcashId + '\')"><i class="fa fa-remove"></i>删除</a>');
                //         return actions.join('');
                //     }
                // }
                ]
        };
        $.table.init(options);
    });
</script>
</body>
</html>